home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / What's New? / Software Development Kits / Mac OS USB DDK / MacOS USB DDK 1.0b4 / NeptuneDDK / Examples / KeyboardModule / KeyboardModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-26  |  2.8 KB  |  95 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        KeyboardModule.h
  3.  
  4.     Contains:    Header file for Keyboard Module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __KeyboardModuleH__
  12. #define __KeyboardModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <USB.h>
  19.  
  20. void     PostUSBKeyToMac(UInt16 rawUSBkey);
  21. void    PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
  22.  
  23. void    USBDemoKeyIn(UInt8 theDeviceClass, void * theData);
  24. void    InitUSBKeyboard(void);
  25. void     KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
  26.  
  27. Boolean    SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
  28.  
  29. static     OSStatus    KeyboardModuleInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  30. static     OSStatus    KeyboardInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  31. static     OSStatus    KeyboardModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  32.  
  33. void    KeyboardModuleInitiateTransaction(USBPB *pb);
  34. void    KeyboardModuleDelay1CompletionProc(USBPB *pb);
  35. void    KeyboardCompletionProc(USBPB *pb);
  36. void    DriverEntry(USBDeviceRef device, USBDeviceDescriptorPtr pDeviceDescriptor);
  37. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  38.  
  39. OSErr FindHIDInterfaceByProtocol(LogicalAddress pConfigDesc, UInt32 ReqProtocol, USBInterfaceDescriptorPtr * hInterfaceDesc);
  40. void NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
  41.  
  42. #define kKeyboardRetryCount        10
  43. #define kKeyboardModifierBits    8
  44. #define kKeyboardReportKeys        6
  45. #define    kKeyboardOffsetToKeys    2
  46. #define kKeyboardReportSize        8
  47.  
  48. enum driverstages
  49. {
  50.     kUndefined = 0,
  51.     kSetKeyboardLEDs,
  52.     kGetFullConfiguration,
  53.     kFindInterfaceAndSetProtocol,
  54.     kSetIdleRequest,
  55.     kFindAndOpenInterruptPipe,
  56.     kReadInterruptPipe,
  57.     kReturnFromDriver =     0x1000,
  58.     kRetryTransaction =     0x2000,
  59.     kSyncTransaction =         0x4000,
  60.     kCompletionPending =     0x8000
  61. };
  62.  
  63. typedef struct
  64. {
  65.     USBPB                             pb;
  66.     void (*handler)(USBPB             *pb);
  67.  
  68.     USBDeviceRef                    deviceRef;
  69.     USBInterfaceRef                    interfaceRef;
  70.     USBPipeRef                        pipeRef;
  71.     
  72.     USBDeviceDescriptor             deviceDescriptor;
  73.     USBInterfaceDescriptor            interfaceDescriptor;
  74.  
  75.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  76.     USBInterfaceDescriptorPtr        pInterfaceDescriptor;
  77.     USBEndPointDescriptorPtr        pEndpointDescriptor;
  78.     
  79.     UInt32                            hidDeviceType;
  80.     UInt8                            hidReport[8];
  81.     UInt8                            oldHIDReport[8];
  82.     UInt8                            padding[8];
  83.     
  84.     Boolean                            sendRawReportFlag;
  85.     Boolean                            hidEmulationInit;
  86.     
  87.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  88.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  89.     
  90.     SInt32                             retryCount;
  91.     SInt32                            delayLevel;
  92.     SInt32                            transDepth;
  93. } usbKeyboardPBStruct;
  94.  
  95. #endif //__KeyboardModuleH__